import React, { Component } from 'react'

export default class index extends Component {

  jia = () =>{
    this.props.jia(this.seValue.value * 1)
  }
  jian = () =>{
    this.props.jian(this.seValue.value * 1)
  }
  jiJia = () =>{
    if(this.props.count % 2 !== 0){
      this.props.jia(this.seValue.value * 1)
    }
  }
  yiJian = () =>{
    this.props.yiJia(this.seValue.value * 1,1000)
  }
  render() {
    console.log("打印了",this.props);
    return (
      <div>
        <h2>当前的和为：{this.props.count}</h2>
        <select name="" id="" ref={(c)=>{this.seValue = c}} >
          <option value="1">1</option>
          <option value="2">2</option>
          <option value="3">3</option>
        </select>&nbsp;
        <button onClick={this.jia}>+</button>&nbsp;
        <button onClick={this.jian}>-</button>&nbsp;
        <button onClick={this.jiJia}>当前和为奇数则加</button>&nbsp;
        <button onClick={this.yiJian}>异步加</button>&nbsp;
      </div>
    )
  }
}
